<%-- 
    Document   : reply_form
    Created on : Apr 28, 2013, 7:11:47 PM
    Author     : wan.fairul
--%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>.: Personal Task :.</title>  
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.blockUI.js"></script> 
        <script type="text/javascript">
            function popupWinTask(id) {
                var url = '${pageContext.request.contextPath}/personalTask?viewDocs&ids=' + id;

                var left = (screen.width / 2) - (500 / 2);
                var top = (screen.height / 2) - (600 / 2);
                var params = 'width=1000';
                params += ', height=1000';
                params += ', top=' + top;
                params += ', left=' + left;
                //params += ', fullscreen=yes';
                params += ', directories=no';
                params += ', location=no';
                params += ', menubar=no';
                params += ', resizable=no';
                params += ', scrollbars=yes';
                params += ', status=no';
                params += ', toolbar=no';
                newwin = window.open(url, 'PopUp', params);
                if (window.focus) {
                    newwin.focus();
                }
                return false;
            }

            function unblockUI() {
                $.unblockUI();
            }

            function blockUI() {
                $.blockUI();
            }

            function popupWin() {
                var url = '${pageContext.request.contextPath}/personalTask?editDocuments';
                var left = (screen.width / 2) - (1000 / 2);
                var top = (screen.height / 2) - (1000 / 2);
                var params = 'width=1000';
                params += ', height=1000';
                params += ', top=' + top;
                params += ', left=' + left;
                //params += ', fullscreen=yes';
                params += ', directories=no';
                params += ', location=no';
                params += ', menubar=no';
                params += ', resizable=no';
                params += ', scrollbars=yes';
                params += ', status=no';
                params += ', toolbar=no';
                newwin = window.open(url, 'PopUp', params);
                if (window.focus) {
                    newwin.focus();
                }
                return false;
            }

            function validateFirst(form) {
                var validate = true;
                var message = "Please enter message";
                if ($("#msg").val() === '')
                    validate = false;
                if (validate === false)
                    alert(message);
                if (validate === true)
                {
                    document.getElementById("replyBtn").disabled = true;
                    form.saveReplyForm.value = "The form is being submitted, please wait a moment...";
                    form.action = form.action + '?saveReplyForm';
                    form.submit();
                    return true;
                }
                return validate;
            }

            function popupReport(id) {
                var url = '';
                url = '${pageContext.request.contextPath}/report?genReportPersonalTaskByIText&id=' + id;
                var left = (screen.width / 2) - (1000 / 2);
                var top = (screen.height / 2) - (1000 / 2);
                var params = 'width=1000';
                params += ', height=1000';
                params += ', top=' + top;
                params += ', left=' + left;
                //params += ', fullscreen=yes';
                params += ', directories=no';
                params += ', location=no';
                params += ', menubar=no';
                params += ', resizable=no';
                params += ', scrollbars=yes';
                params += ', status=no';
                params += ', toolbar=no';
                newwin = window.open(url, 'PopUp', params);
                if (window.focus) {
                    newwin.focus();
                }
                return false;
            }
        </script>
    </head>
    <body>
        <s:messages/>
        <s:errors/>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.PersonalAction" name="form1">      
            <s:hidden name="task.personalTaskId"/> 
            <div>
                <fieldset>
                    <div>
                        <div id="page-title">
                            <span class="title">General Information</span>
                        </div>
                        <p>
                            <label><b>Subject :</b></label>
                            ${actionBean.task.subject}&nbsp;
                        </p>
                        <table border="0">
                            <tr><td><label><b>Score Point:</b></label>
                                    ${actionBean.staff.scorePoint}&nbsp;</td>
                                <td><label><b>Priority :</b></label>
                                    ${actionBean.task.priorityCode.priorityName}&nbsp;</td>
                            </tr>
                            <tr><td> <label><b>Priority Day:</b></label>
                                    ${actionBean.task.priorityDayCount}&nbsp;</td>
                                <td> <label><b>Status :</b></label>
                                    ${actionBean.task.statusRemarks}&nbsp;</td>
                            </tr>
                            <c:if test="${actionBean.task.duedate ne null}">
                                <tr>
                                    <td>  <label><b>Due Date :</b></label>
                                        <fmt:formatDate value="${actionBean.task.duedate}" pattern="dd/MM/yyyy"/></td>
                                        <c:if test="${actionBean.task.statusRemarks eq 'Open'}"> 
                                        <td> <label><b>Day Left:</b></label>
                                            ${actionBean.dayLeft}&nbsp;</td>
                                        </c:if>
                                </tr>
                            </c:if>

                        </table>
                    </div>      
                    <div>
                        <div id="page-title">
                            <span class="title">History</span>
                        </div>
                        <display:table class="tablecloth" name="${actionBean.listTaskSummary}" requestURI="/personalTask?reply_form" id="line">
                            <display:column title="No." ><center>${line_rowNum}.</center></display:column>
                                <display:column title="From" property="fromUser"/>    
                                <display:column title="Message"><textarea rows="7" cols="90" readonly="true">${line.message}</textarea></display:column>
                            <display:column title="Date Submit"><fmt:formatDate value="${line.dateSubmit}" pattern="dd/MM/yyyy"/> </display:column>
                            <display:column title="Document">
                                <c:if test="${!empty(line.folder.documents)}"> <a href="#" onclick="popupWinTask(${line.taskSummaryId});">VIEW</a></c:if>    
                            </display:column>     
                        </display:table>
                        <s:submit name="" value="Generate PDF" onclick="return popupReport('${actionBean.task.personalTaskId}');" class="btn" />
                    </div> 
                    <div>
                        <div id="page-title">
                            <span class="title">Personal Task Form</span>
                        </div>
                        <p>
                            <label>Message :</label>
                            <s:textarea name="msg"  rows="15" cols="90" id="msg" class="clearAll"/>
                        </p>
                        <p>
                            <label>Upload :</label>
                            <s:button name="" value="Upload" class="btn" onclick="popupWin()"/>
                        </p>
                        <p>
                            <label>&nbsp;</label>
                            <s:submit name="saveReplyForm" id="replyBtn" value="Submit" class="btn" onclick="return validateFirst(this.form)"/>
                            <s:button name="clear" value="Clear" class="btn clear"/>
                        </p>
                    </div> 
                </fieldset>
            </div>


        </s:form>
    </body>
</html>
